/*    */ package configs;
/*    */

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import server.Timer;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */ 
/*    */ public class OpcodeConfig {
/* 14 */   private static final Logger log = LogManager.getLogger();
/* 15 */   private static final List<String> blockops = new ArrayList<>();
/*    */   
/*    */   public static void load() {
/* 18 */     final File file = new File("./config/opcode.properties");
/* 19 */     if (!file.exists()) {
/* 20 */       log.error("读取opcode配置文件失败");
/*    */       return;
/*    */     } 
/* 23 */     Timer.WorldTimer.getInstance().register(new Runnable()
/*    */         {
/*    */           public synchronized void run() {
/*    */             try {
/* 27 */               OpcodeConfig.blockops.clear();
/* 28 */               Properties props = new Properties();
/* 29 */               FileInputStream fileInputStream = new FileInputStream(file);
/* 30 */               InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "GBK");
/* 31 */               BufferedReader buff = new BufferedReader(inputStreamReader);
/* 32 */               props.load(buff);
/* 33 */               buff.close();
/* 34 */               inputStreamReader.close();
/* 35 */               fileInputStream.close();
/*    */               
/* 37 */               String sendops = props.getProperty("sendops"), recvops = props.getProperty("recvops");
/*    */               
/* 39 */               for (String s : sendops.split(",")) {
/* 40 */                 OpcodeConfig.blockops.add("S_" + s);
/*    */               }
/*    */               
/* 43 */               for (String s : recvops.split(",")) {
/* 44 */                 OpcodeConfig.blockops.add("R_" + s);
/*    */               }
/*    */             }
/* 47 */             catch (IOException e) {
/* 48 */               e.printStackTrace();
/*    */             } 
/*    */           }
/*    */         },1000L, 1000L);
/*    */   }
/*    */   
/*    */   public static boolean isblock(String ops, boolean issend) {
/* 55 */     return blockops.contains(issend ? ("S" + ops) : ("R" + ops));
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\configs\OpcodeConfig.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */